Skip to content

fix: increase terminal max-width from 120 to 1024#596

Open
zhaider3c wants to merge 1 commit into
Nano-Collective:mainfrom
zhaider3c:fix/increase-terminal-max-width-1024
Open

fix: increase terminal max-width from 120 to 1024#596
zhaider3c wants to merge 1 commit into
Nano-Collective:mainfrom
zhaider3c:fix/increase-terminal-max-width-1024

Conversation

@zhaider3c

Copy link
Copy Markdown

Summary

Removes the hardcoded 120-column cap in useTerminalWidth, replacing it with 1024. This lets content fill wide terminal windows instead of leaving ~74 columns of empty space on a 190-col terminal.

Changes

  • source/hooks/useTerminalWidth.tsxMath.min(columns - 4, 120)Math.min(columns - 4, 1024)
  • source/constants.tsDEFAULT_TERMINAL_WIDTH = 120DEFAULT_TERMINAL_WIDTH = 1024

Related

Closes #595

The calculateBoxWidth function in useTerminalWidth capped content width at 120 columns regardless of terminal size, wasting horizontal space on wide terminals (>190 cols). Bumped to 1024, matching the existing DEFAULT_TERMINAL_WIDTH constant.

Closes Nano-Collective#595

@akramcodez akramcodez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhaider3c Thanks for the contribution! The implementation correctly updates the terminal width limits and addresses the original issue.

One thing still needs updating before this can be merged: the corresponding unit test still expects the previous maximum width (120). Since the implementation now uses 1024, the test should be updated accordingly to reflect the new behavior and ensure the change is covered.

Once the test expectation is updated, I'd be happy to approve.

@will-lamerton

Copy link
Copy Markdown
Member

Thanks for tackling this - the diff is small, focused, and easy to review. That said, I agree with the framing in the linked issue that something should give on the 120 cap, but I'd push back on going all the way to 1024. A few thoughts:

Why the cap exists

The 120 ceiling isn't an accident or a forgotten constant - it's doing real work. CLI UX research and most well-designed TUIs converge on ~100–120 columns because:

  • Long single-line content (diffs, table rows, code snippets wrapped in boxes) reads worse when stretched. The eye loses the line and re-finds it on every row.
  • Side-by-side panels, two-column layouts, and aligned ASCII art only look balanced when the box itself has a known upper bound — otherwise a 300-col terminal gives you a full-width box on the left and a wasteland on the right.
  • It caps pathological cases: a user pipes output into a non-TTY reporter that reports columns: 99999, or resizes the window very wide mid-session. Without an upper bound, transient frames can blow up cli-table3 column math in source/markdown-parser/table-parser.ts:51 and the file-ops previews.

So I don't think the right fix is "remove the cap." A configurable, sensible default is.

The middle ground I'd suggest

Something like 160 or 200 for the default - high enough that a 190-col terminal (the exact case from the issue) gets its full ~186 usable columns back, low enough that genuinely wide terminals don't produce comically stretched boxes. Concretely:

  • source/constants.ts:50DEFAULT_TERMINAL_WIDTH = 160 (or 200)
  • source/hooks/useTerminalWidth.tsx:8Math.max(Math.min(columns - 4, 160), 40)
  • Better still: read it from nanocoder-preferences.json with the constant as the default, which is the third option the issue itself proposes. That sidesteps the "what's the right number" debate entirely.

Let me know your thoughts :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hardcoded 120-column max width ignores large terminals

3 participants